package dongze.com.ckdj.databinding.model;

import android.databinding.BaseObservable;
import android.databinding.Bindable;
import android.widget.SpinnerAdapter;

import dongze.com.ckdj.BR;
import dongze.com.ckdj.databinding.BindingUtil;
import dongze.com.ckdj.fragment.PortInspectionFragment;
import dongze.com.ckdj.util.Util;

/**
 * Created by fanqwz on 2017/7/20.
 */

public class InformationItemSpinnerModel extends BaseObservable {
    String key;
    int position;
    String[] values;
    SpinnerAdapter spinnerAdapter;

    @Bindable
    public SpinnerAdapter getSpinnerAdapter() {
        return spinnerAdapter;
    }

    public void setSpinnerAdapter(SpinnerAdapter spinnerAdapter) {
        this.spinnerAdapter = spinnerAdapter;
        notifyPropertyChanged(BR.spinnerAdapter);
    }

    @Bindable
    public String getKey() {
        return key;
    }

    public void setKey(String key) {
        if (BindingUtil.isNotEqual(this.key, key)) {
            this.key = key;
            notifyPropertyChanged(BR.key);
        }
    }

    @Bindable
    public String[] getValues() {
        return values;
    }

    public void setValues(String[] values) {
        if (BindingUtil.isNotEqual(this.values, values)) {
            this.values = values;
            Util.fillStringArrayNullValue(values);
            notifyPropertyChanged(BR.values);
        }
    }

    @Bindable
    public int getKeyColor() {
        return keyColor;
    }

    public void setKeyColor(int keyColor) {
        if (BindingUtil.isNotEqual(this.keyColor, keyColor)) {
            this.keyColor = keyColor;
            notifyPropertyChanged(BR.keyColor);
        }
    }

    int keyColor = 0xFF000000;

    @Bindable
    public int getPosition() {
        return position;
    }

    public void setPosition(int position) {
        if (BindingUtil.isNotEqual(this.position, position)) {
            this.position = position;
            notifyPropertyChanged(BR.position);
        }
    }
}
